﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Xml.Serialization;

namespace TinyEngine.Editor.Extensibility
{
    public class CachedSession
    {
        public string ProjectPath { get; set; }
        public string ScenePath { get; set; }

        internal void Save()
        {
            var writer = new StreamWriter("cached");
            var ser = new XmlSerializer(typeof(CachedSession));
            ser.Serialize(writer, this);
            writer.Close();
        }

        internal void Load()
        {
            var writer = new StreamReader("cached");
            var ser = new XmlSerializer(typeof(CachedSession));
            var obj = (CachedSession)ser.Deserialize(writer);
            this.ProjectPath = obj.ProjectPath;
            this.ScenePath = obj.ScenePath;
            writer.Close();
        }
    }
}
